{% extends 'layout.html' %}

{% load custom_tags %}

{% block main %}
<div class="container">

    {% for category, courses in course_dict.items %}
    <div class="card my-4">
        <!-- Be careful: https://stackoverflow.com/a/51033866/15172980 -->
        <h5 class="card-header">{{category}}课程
            <span class="badge rounded-pill bg-light text-dark">
                {{views_dict|get_item:category }}学过
            </span>
        </h5>
        <div class="card-body">
            {% for course in courses %}
            <a href="/course/{{ course.id }}/" class="btn btn-outline-secondary mx-1">
                {{ course.name }}
            </a>
            {% endfor %}
        </div>
    </div>
    {% endfor %}
</div>
{% endblock %}